package(default_visibility = ["//tools/build_defs:internal_pkg"])

licenses(["notice"])  # Apache 2.0

cc_library(
    name = "mac_set_wrapper",
    srcs = ["mac_set_wrapper.cc"],
    hdrs = ["mac_set_wrapper.h"],
    include_prefix = "tink",
    strip_include_prefix = "/cc",
    visibility = ["//visibility:private"],
    deps = [
        "//cc:crypto_format",
        "//cc:mac",
        "//cc:primitive_set",
        "//cc/util:status",
        "//cc/util:statusor",
        "//cc/subtle:subtle_util_boringssl",
        "//proto:tink_cc_proto",
    ],
)

cc_library(
    name = "mac_config",
    srcs = ["mac_config.cc"],
    hdrs = ["mac_config.h"],
    include_prefix = "tink",
    strip_include_prefix = "/cc",
    deps = [
        ":mac_catalogue",
        "//cc:config",
        "//cc/util:status",
        "//proto:config_cc_proto",
    ],
)

cc_library(
    name = "mac_catalogue",
    srcs = ["mac_catalogue.cc"],
    hdrs = ["mac_catalogue.h"],
    include_prefix = "tink",
    strip_include_prefix = "/cc",
    deps = [
        ":hmac_key_manager",
        "//cc:catalogue",
        "//cc/util:status",
    ],
)

cc_library(
    name = "mac_factory",
    srcs = ["mac_factory.cc"],
    hdrs = ["mac_factory.h"],
    include_prefix = "tink",
    strip_include_prefix = "/cc",
    deps = [
        ":mac_set_wrapper",
        "//cc:key_manager",
        "//cc:keyset_handle",
        "//cc:mac",
        "//cc:primitive_set",
        "//cc:registry",
        "//cc/util:status",
        "//cc/util:statusor",
    ],
)

cc_library(
    name = "mac_key_templates",
    srcs = ["mac_key_templates.cc"],
    hdrs = ["mac_key_templates.h"],
    include_prefix = "tink",
    strip_include_prefix = "/cc",
    deps = [
        "//proto:common_cc_proto",
        "//proto:hmac_cc_proto",
        "//proto:tink_cc_proto",
    ],
)

cc_library(
    name = "hmac_key_manager",
    srcs = ["hmac_key_manager.cc"],
    hdrs = ["hmac_key_manager.h"],
    include_prefix = "tink",
    strip_include_prefix = "/cc",
    deps = [
        "//cc:key_manager",
        "//cc:mac",
        "//cc/subtle:hmac_boringssl",
        "//cc/subtle:random",
        "//cc/util:enums",
        "//cc/util:errors",
        "//cc/util:protobuf_helper",
        "//cc/util:status",
        "//cc/util:statusor",
        "//cc/util:validation",
        "//proto:common_cc_proto",
        "//proto:hmac_cc_proto",
        "//proto:tink_cc_proto",
    ],
)

# tests

cc_test(
    name = "mac_set_wrapper_test",
    size = "small",
    srcs = ["mac_set_wrapper_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":mac_set_wrapper",
        "//cc:crypto_format",
        "//cc:mac",
        "//cc:primitive_set",
        "//cc/util:status",
        "//cc/util:test_util",
        "//proto:tink_cc_proto",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "mac_catalogue_test",
    size = "small",
    srcs = ["mac_catalogue_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":mac_catalogue",
        ":mac_config",
        "//cc:catalogue",
        "//cc:config",
        "//cc/util:status",
        "//cc/util:statusor",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "mac_config_test",
    size = "small",
    srcs = ["mac_config_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":mac_config",
        "//cc:catalogue",
        "//cc:config",
        "//cc:mac",
        "//cc:registry",
        "//cc/util:status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "mac_factory_test",
    size = "small",
    srcs = ["mac_factory_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":mac_config",
        ":mac_factory",
        ":mac_set_wrapper",
        "//cc:config",
        "//cc:crypto_format",
        "//cc:keyset_handle",
        "//cc:mac",
        "//cc/mac:hmac_key_manager",
        "//cc/util:keyset_util",
        "//cc/util:status",
        "//cc/util:test_util",
        "//proto:common_cc_proto",
        "//proto:hmac_cc_proto",
        "//proto:tink_cc_proto",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "mac_key_templates_test",
    size = "small",
    srcs = ["mac_key_templates_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":hmac_key_manager",
        ":mac_key_templates",
        "//proto:common_cc_proto",
        "//proto:hmac_cc_proto",
        "//proto:tink_cc_proto",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "hmac_key_manager_test",
    size = "small",
    srcs = ["hmac_key_manager_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":hmac_key_manager",
        "//cc:mac",
        "//cc/util:status",
        "//cc/util:statusor",
        "//proto:aes_ctr_cc_proto",
        "//proto:aes_ctr_hmac_aead_cc_proto",
        "//proto:common_cc_proto",
        "//proto:hmac_cc_proto",
        "//proto:tink_cc_proto",
        "@com_google_googletest//:gtest_main",
    ],
)
